; *** Fox and Geese
; *** Copyright 1998-2002 Zillions Development
; v.2.0

; You need to purchase Zillions of Games to load this rules file
; Visit the Zillions web site at http://www.zillions-of-games.com

(version "2.0")
(translate
 ("Fox" "狐狸") ("Goose" "鹅")
 ("Fox-Player" "狐狸") ("Geese" "鹅")
 ("Wolf-Player" "狼") ("Goats" "羊")
 ("Wolf" "狼") ("Goat" "羊")
 ("Leopards" "豹") ("Cows" "牛")
 ("Leopard" "豹") ("Cow" "牛")
 ("Rebels" "小兵") ("General-Side" "将军")
 ("Rebel" "兵") ("General" "将")
)

(define shift ($1 (verify empty?) add) )
(define rebel-shift ($1 (verify (and empty? (not-in-zone? Privy))) add) )
(define jump  ($1 (verify enemy?) capture $1 (verify empty?) (add-partial jumptype)) )
(define jump1 ($1 (verify enemy?) capture $1 (verify empty?) add) )
(define shift-jump ($1 (if empty? add else (verify enemy?) capture $1 (verify empty?) add)) )

(define intervention-shift (
	$1
	(verify empty?)
	(if (and (enemy? $2) (enemy? $3)) (capture $2) (capture $3))
	(if (and (enemy? $4) (enemy? $5)) (capture $4) (capture $5))
	(if (and (enemy? $6) (enemy? $7)) (capture $6) (capture $7))
	add
))
(define custodian-check
	(if (enemy? $1) $1 (if (friend? $1) capture) back)
)
(define custodian-shift (
	$1
	(verify (and empty? (not-in-zone? Privy)))
	mark
	(custodian-check $2)
	(custodian-check $3)
	(custodian-check $4)
	(custodian-check $5)
	(custodian-check $6)
	(custodian-check $7)
	(custodian-check $8)
	add
))

(game
    (title "狐狸与鹅-1v13")
    (description "红色棋子（狐狸）的目标是吃掉黄色棋子（鹅），使得鹅的数量小于7只则获胜。\
鹅的目标则是让狐狸无法移动则获胜。\
狐狸和鹅均可横、竖、斜走一步。鹅不可吃狐狸，狐狸可以跳过一只鹅到它后面的空格将这只鹅捕杀，并且可以连跳。")
    (history "This was the original variation of this game, which spread from
       Scandinavia to Europe in the Middle Ages.")
    (strategy "The Geese should stick together in a mass.  In this way they can
       eventually surround the Fox and win.  We suggest you make Zillions play
       the Fox.")
    (players Fox-Player Geese)
    (turn-order Fox-Player Geese)
	(click-sound "Audio\\Tink.wav")
    (release-sound "Audio\\Ding.wav")
    (move-sound "Audio\\Ding.wav")

    (board
        (image "images\Solitaire\English3.bmp" "images\Solitaire\English2.bmp")
        (grid
            (start-rectangle 3 3 29 29) ; top-left position
            (dimensions ;7x7
                ("a/b/c/d/e/f/g" (32 0)) ; columns
                ("7/6/5/4/3/2/1" (0 32)) ; rows
			)
			(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0)
                        (nw -1 -1) (ne 1 -1) (sw -1 1) (se 1 1))
		)
        (kill-positions a1 a2 b1 b2 a6 a7 b6 b7 f1 f2 g1 g2 f6 f7 g6 g7)
        (zone
           (name Top-Edge)
           (players Fox-Player)
           (positions c7 d7 e7)
         )
	)

    (piece
      (name Fox)
	  (help "狐狸：八方1格，跳杀")
      (description "狐狸\狐狸可以向八个方向走1格。可以跳过一只鹅并落在它身后的空格吃掉它。可以连吃。")
      (image Fox-Player "images\Solitaire\RedMarble2.bmp" "images\Solitaire\RedMarble.bmp")
      (moves
         (move-type jumptype)
         (jump n)
         (jump s)
         (jump e)
         (jump w)
		 (jump nw)
		 (jump ne)
		 (jump sw)
		 (jump se)

         (move-type nonjumptype)
         (shift n)
         (shift s)
         (shift e)
         (shift w)
         (shift nw)
		 (shift ne)
         (shift sw)
		 (shift se)
      )
	)
 
    (piece
      (name Goose)
	  (help "鹅：八方一格，狐狸的猎物")
	  (description "鹅\八方一格，不能吃子。")
      (image Geese "images\Solitaire\YellowMarble2.bmp" "images\Solitaire\YellowMarble.bmp")
      (moves
         (shift n)
         (shift s)
         (shift e)
         (shift w)
         (shift nw)
		 (shift ne)
         (shift sw)
		 (shift se)
      )			
	)
        
    (board-setup
        (Geese (Goose
                     c7 d7 e7
                     c6 d6 e6
               a5 b5 c5 d5 e5 f5 g5
        ))
        (Fox-Player (Fox d4))
    )

    (loss-condition (Geese) (or (pieces-remaining 6 Goose)
                                (pieces-remaining 5 Goose)
                                (pieces-remaining 4 Goose)
                                (pieces-remaining 3 Goose)
                                (pieces-remaining 2 Goose)
                                (pieces-remaining 1 Goose)))
    (loss-condition (Fox-Player Geese) stalemated)
)

(variant
    (title "狐狸与鹅-1v15")
    (description "红色棋子（狐狸）的目标是吃掉黄色棋子（鹅），使得鹅的数量小于7只则获胜。或将狐狸移动到棋盘最上一行也可获胜。\
鹅的目标则是让狐狸无法移动则获胜。\
狐狸可横、竖、斜走一步。鹅不可吃狐狸，狐狸可以跳过一只鹅到它后面的空格将这只鹅捕杀，并且可以连跳。\
1v15版本，狐狸能吃子必须吃子。鹅不能后退。") ; Could also add orthogonal-only 15 variant
    (history "The Fox and Geese game was a Viking game, popular in Europe in the
       Middle Ages.  By restricting the Geese from moving upwards, players hoped to
       give the Fox a better chance.")
    (strategy "The Geese should stick together in a mass.  We suggest you make
       Zillions play the Fox.")
    (move-priorities jumptype nonjumptype)
    (piece
      (name Goose)
	  (help "鹅：除向上三个方向外一格，狐狸的猎物")
	  (description "Goose\可沿左、左下、右、右下、下方向走一格。不可吃子。.")
      (image Geese "images\Solitaire\YellowMarble2.bmp" "images\Solitaire\YellowMarble.bmp")
      (moves
         (shift s)
         (shift e)
         (shift w)
         (shift sw)
		 (shift se)
      )			
	)
    (board-setup
        (Geese (Goose
                     c7 d7 e7
                     c6 d6 e6
               a5 b5 c5 d5 e5 f5 g5
               a4                g4
        ))
        (Fox-Player (Fox d4))
	)
    (loss-condition (Geese) (or (pieces-remaining 6 Goose)
                                (pieces-remaining 5 Goose)
                                (pieces-remaining 4 Goose)
                                (pieces-remaining 3 Goose)
                                (pieces-remaining 2 Goose)
                                (pieces-remaining 1 Goose)))
    (loss-condition (Fox-Player Geese) stalemated)
    (win-condition (Fox-Player) (absolute-config Fox (Top-Edge)))
)


(variant
    (title "狐狸与鹅-1v17")
    (description "红色棋子（狐狸）的目标是吃掉黄色棋子（鹅），使得鹅的数量小于7只则获胜。或将狐狸移动到棋盘最上一行也可获胜。\
鹅的目标则是让狐狸无法移动则获胜。\
狐狸可横、竖、斜走一步。鹅不可吃狐狸，狐狸可以跳过一只鹅到它后面的空格将这只鹅捕杀，并且可以连跳。
\1v17版本，狐狸能吃必须吃，鹅只能向下、左、右直线移动。。") ; Could also add non-orthogonal 17 variant, or variant with 2 Foxes
    (history "The Fox and Geese game was a Viking game, popular in Europe in the
       Middle Ages.  By restricting the Geese's movement, players hoped to
       give the Fox a better chance.")
    (strategy "The Geese should stick together in a mass.  We suggest you make
       Zillions play the Fox.")
    (move-priorities jumptype nonjumptype)
    (piece
      (name Goose)
	  (help "鹅：左右下一格，狐狸的猎物")
	  (description "鹅\可沿左、右、下一格，不可吃子。")
      (image Geese "images\Solitaire\YellowMarble2.bmp" "images\Solitaire\YellowMarble.bmp")
      (moves
         (shift s)
         (shift e)
         (shift w)
      )			
	)
    (board-setup
        (Geese (Goose
                     c7 d7 e7
                     c6 d6 e6
               a5 b5 c5 d5 e5 f5 g5
               a4                g4
               a3                g3
        ))
        (Fox-Player (Fox d4))
	)
    (loss-condition (Geese) (or (pieces-remaining 6 Goose)
                                (pieces-remaining 5 Goose)
                                (pieces-remaining 4 Goose)
                                (pieces-remaining 3 Goose)
                                (pieces-remaining 2 Goose)
                                (pieces-remaining 1 Goose)))
    (loss-condition (Fox-Player Geese) stalemated)
    (win-condition (Fox-Player) (absolute-config Fox (Top-Edge)))
)

(variant
   (title "-") ; ---------------------------------------------------
)

(variant
   (title "狐狸与鹅-国跳版")
   (description "狐狸（红色棋子）的目标是抵达最上一线；鹅（黑色棋子）的目标是使狐狸无法移动。\
狐狸可斜走一格，但鹅只能斜前走一格。均不能吃子。")
   (history "The Fox and Geese games was a viking game, popular in Europe in the
       Middle Ages.")
   (strategy "The Geese should stick together in a line across the board.  By
       doing so they should win.  The Fox should look for gaps to slip through.")
   (click-sound "Audio\\WoodClick.wav")
   (release-sound "Audio\\WoodClick.wav")
   (move-sound "Audio\\WoodClick.wav")
   (board  
      (image "images\Checkers\SHaag\checkbd2.bmp" "images\Checkers\checkbd2.bmp")
      (grid
         (start-rectangle 6 6 55 55)
         (dimensions
             ("a/b/c/d/e/f/g/h" (50 0)) ; files
             ("8/7/6/5/4/3/2/1" (0 50)) ; ranks
         )
         (directions (ne 1 -1) (nw -1 -1) (se 1 1) (sw -1 1))
      )
      (zone
         (name Top-Edge)
         (players Fox-Player)
         (positions b8 d8 f8 h8)
      )
      (symmetry Geese (nw sw)(sw nw) (ne se)(se ne))
   )
   (piece
      (name Fox)
	  (help "狐狸：斜走一格，跑啊跑啊跑")
	  (description "狐狸\狐狸可以斜向走一格。不吃子。")
      (image Fox-Player "images\Checkers\SHaag\chkrRM.bmp" "images\Checkers\chkrRM.bmp")
      (moves
         (shift nw)
		 (shift ne)
         (shift sw)
		 (shift se)
      )
   )
   (piece
      (name Goose)
	  (help "鹅：斜前一格，追啊追啊追")
	  (description "鹅\鹅走法同国际跳棋，即只能斜前一格，但不可升级，也不可吃子。")
      (image Geese "images\Checkers\SHaag\chkrBM.bmp" "images\Checkers\chkrBM.bmp")
      (moves
         (shift nw)
		 (shift ne)
      )
   )
   (board-setup
      (Geese (Goose b8 d8 f8 h8))
      (Fox-Player (Fox e1))
   )

   (loss-condition (Fox-Player) stalemated)
   (win-condition (Fox-Player) (absolute-config Fox (Top-Edge)))
 )

 (variant
   (title "狼入羊群-国跳版")
   (description "狼（红色棋子）的目标是突围到最上一线；羊（黑色棋子）的目标是困死狼使其无法移动。\狼也可以把羊吃光获胜。\
羊只能斜前移动。狼四个斜方向均可移动，并且可以连续跳吃。")
   (history "Wolf and Goats is a variant of a Viking game, popular in Europe in the
       Middle Ages.  In this variation the Fox is called a Wolf and the Geese are
       known as Goats.")
   (strategy "The Goats should stick together so the Wolf can't slip past.  By
       doing so they should win.")
   (players Wolf-Player Goats)
   (turn-order Wolf-Player Goats)
   (click-sound "Audio\\WoodClick.wav")
   (release-sound "Audio\\WoodClick.wav")
   (move-sound "Audio\\WoodClick.wav")
   (board  
      (image "images\Checkers\SHaag\checkbd2.bmp" "images\Checkers\checkbd2.bmp")
      (grid
         (start-rectangle 6 6 55 55)
         (dimensions
             ("a/b/c/d/e/f/g/h" (50 0)) ; files
             ("8/7/6/5/4/3/2/1" (0 50)) ; ranks
         )
         (directions (ne 1 -1) (nw -1 -1) (se 1 1) (sw -1 1))
      )
      (zone
         (name Top-Edge)
         (players Wolf-Player)
         (positions b8 d8 f8 h8)
      )
      (symmetry Goats (nw sw)(sw nw) (ne se)(se ne))
   )
   (piece
      (name Wolf)
	  (help "狼：信不信我都吃了你们")
	  (description "狼\狼可以沿四个斜方向移动，并且可以连续跳吃。")
      (image Wolf-Player "images\Checkers\SHaag\chkrRM.bmp" "images\Checkers\chkrRM.bmp")
      (moves
         (move-type jumptype)
		 (jump nw)
		 (jump ne)
		 (jump sw)
		 (jump se)

         (move-type nonjumptype)
         (shift nw)
		 (shift ne)
         (shift sw)
		 (shift se)
      )
   )
   (piece
      (name Goat)
	  (help "羊：围住它！")
	  (description "羊\只可以斜前移动，且无法吃子。")
      (image Goats "images\Checkers\SHaag\chkrBM.bmp" "images\Checkers\chkrBM.bmp")
      (moves
         (shift nw)
		 (shift ne)
      )
   )
   (piece (name Goose))
   (piece (name Fox))

   (board-setup
      (Goats (Goat b8 d8 f8 h8 a7 c7 e7 g7 b6 d6 f6 h6))
      (Wolf-Player (Wolf e1))
   )

   (loss-condition (Goats) (pieces-remaining 0 Goat))
   (loss-condition (Wolf-Player) stalemated)
   (win-condition (Wolf-Player) (absolute-config Wolf (Top-Edge)))
)

(variant
   (title "-") ; ---------------------------------------------------
)

(variant
    (title "豹子与牛")
    (description "豹子（白色棋子）目标是吃掉8只牛；牛（黄色棋子）的目标是困死两只豹子。\开局时，一只豹位于棋盘中央，另一只在盘外。24只牛均在盘外。一方须把棋子全部落于盘上方可移动。\其余走法与前面的玩法类似，豹子和牛均可沿线移动，豹子可跳杀。")
    (history "Hunt games are universal.  This particular variation,
        played on an Alquerque board, originated in southern Asia.")
    (option "include off-pieces" true)
    (strategy "The Cows should stick together.")
    (players Leopards Cows)
    (turn-order Cows Leopards)
    (move-priorities droptype)
    (board
        (image "images\Alquerque\Sixteen2.bmp" "images\Alquerque\Sixteen.bmp")
        (grid
            (start-rectangle 53 5 77 29); top-left position
            (dimensions ;5 x 5
                ("a/b/c/d/e" (32 0)) ; columns
                ("5/4/3/2/1" (0 32)) ; rows
			)
			(directions (n 0 -1) (s 0 1) (e 1 0) (w -1 0))
		)
		(positions (LL5  13  32  35  52)
		           (LL3   7  70  27  92)
				   (LL1  13 110  35 130)
				   (L4   33  50  53  69)
				   (L3   28  70  53  92)
				   (L2   33  93  53 113)
				   (RR5 223  32 243  52)
		           (RR3 231  70 251  92)
				   (RR1 223 110 243 130)
				   (R4  205  50 225  69)
				   (R3  205  70 230  92)
				   (R2  205  93 225 113)
		)
		(links n (LL1 LL3) (LL3 LL5)
		         (L2 L3) (L3 L4)
				 (RR1 RR3) (RR3 RR5)
				 (R2 R3) (R3 R4)
		)
		(links s (LL5 LL3) (LL3 LL1)
		         (L4 L3) (L3 L2)
				 (RR5 RR3) (RR3 RR1)
				 (R4 R3) (R3 R2)
		)
		(links e (LL3 L3) (L3 a3)
		         (e3 R3) (R3 RR3)
		)
		(links w (a3 L3) (L3 LL3)
		         (RR3 R3) (R3 e3)
		)
        (links ne (a1 b2) (a3 b4) (b2 c3) (b4 c5)
                  (c1 d2) (c3 d4) (d2 e3) (d4 e5)
				  (LL1 L2) (L2 a3)
				  (e3 R4) (R4 RR5)
        )
        (links nw (b2 a3) (b4 a5) (c1 b2) (c3 b4)
                  (d2 c3) (d4 c5) (e1 d2) (e3 d4)
				  (a3 L4) (L4 LL5)
				  (RR1 R2) (R2 e3)
        )
        (links sw (b2 a1) (b4 a3) (c3 b2) (c5 b4)
                  (d2 c1) (d4 c3) (e3 d2) (e5 d4)
				  (a3 L2) (L2 LL1)
				  (RR5 R4) (R4 e3)
        )
        (links se (a3 b2) (a5 b4) (b2 c1) (b4 c3)
                  (c3 d2) (c5 d4) (d2 e1) (d4 e3)
				  (LL5 L4) (L4 a3)
				  (e3 R2) (R2 RR1)
        )
	)
    (board-setup
        (Cows (Cow off 24) (Goose off 0) (Fox off 0))
        (Leopards (Leopard off 1 c3))
        
    )
    (piece
      (name Leopard)
	  (help "豹子：沿线移动一格，可跳杀")
	  (description "豹子可沿线移动一格。可跳吃，但无法连跳。")
      (image Leopards "images\Alquerque\GrayCircle.bmp")
      (drops ((verify empty?) add))
      (moves
         (jump n)
         (jump s)
         (jump e)
         (jump w)
		 (jump nw)
		 (jump ne)
		 (jump sw)
		 (jump se)
         (shift n)
         (shift s)
         (shift e)
         (shift w)
         (shift nw)
		 (shift ne)
         (shift sw)
		 (shift se)
      )
	)
 
    (piece
      (name Cow)
	  (help "牛：沿线移动一格。")
	  (description "牛可沿线移动一格，不可吃子。")
      (image Cows "images\Alquerque\BrownCircle.bmp")
      (drops
         (move-type droptype)
         ((verify empty?) add)
      )
      (moves
         (shift n)
         (shift s)
         (shift e)
         (shift w)
         (shift nw)
		 (shift ne)
         (shift sw)
		 (shift se)
      )			
	)
    (piece (name Goose))
    (piece (name Fox))

    (loss-condition (Leopards Cows) stalemated)
    (loss-condition (Cows) (pieces-remaining 16 Cow)) ; i.e. 8 cows captured
)

(variant
   (title "-") ; ---------------------------------------------------
)

(variant
    (title "16兵对将军")
    (description "源自于中国的玩法。\红色棋子为将军，目标是杀死足够的敌兵，敌兵数量少于6人即算将军胜。\黄色棋子为另一方的兵卒，目标是击杀将军，或者在将军进入大营（右边三角形中的四个点）之后包围大营出口，均算获胜。\
只有将军才可进入大营。\
将军吃法：挖吃，若将军走到的位置上任意两个相反方向的邻位都有敌兵，则这两个敌兵被吃。\
兵卒吃法：夹吃，若一个兵卒走到的位置恰好可以包夹将军，则将军被吃。")
    (history "The game of 16 rebel soldiers is an old Chinese game known as `Shap luk kon
	   tseung kwan` or `16 pursue the general.`  The German scholar Himly wrote in the 1870's
	   that the game was very popular with `laborers and children,` the board being often scratched
	   out in the dust of quiet roads.  Several variations on this game from different sources
	   are provided.")
    (strategy "The Rebels should approach the General, forcing the General to move into a spot
	   where he may be captured.  The Rebels can always win.")
    (players General-Side Rebels)
    (turn-order General-Side Rebels)

    (board
        (image "images\Rebels\16_Rebels2.bmp" "images\Rebels\16_Rebels.bmp")
        (grid
            (start-rectangle 3 3 29 29) ; top-left position
            (dimensions
                ("a/b/c/d/e" (32 0)) ; columns
                ("5/4/3/2/1" (0 32)) ; rows
			)
			(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0))
		)
		(positions (f4  158  46 180  67)
		           (f3  158  68 180  91)
				   (f2  158  92 180 113)
				   (g3  186  68 208  91)
		)
		(links n  (f2 f3) (f3 f4))
		(links s  (f3 f2) (f4 f3))
		(links e  (e2 f2) (e3 f3) (e4 f4) (f3 g3))
		(links w  (f2 e2) (f3 e3) (f4 e4) (g3 f3))
		(links ne (a1 b2) (b2 c3) (c3 d4) (d4 e5)
                  (a3 b4) (b4 c5) (c1 d2) (d2 e3)
				  (f2 g3)
        )
        (links nw (e1 d2) (d2 c3) (c3 b4) (b4 a5)
                  (c1 b2) (b2 a3) (e3 d4) (d4 c5)
				  (g3 f4)
        )
        (links sw (e5 d4) (d4 c3) (c3 b2) (b2 a1)
                  (c5 b4) (b4 a3) (e3 d2) (d2 c1)
				  (g3 f2)
        )
        (links se (a5 b4) (b4 c3) (c3 d2) (d2 e1)
                  (a3 b2) (b2 c1) (c5 d4) (d4 e3)
				  (f4 g3)
        )
        (zone
			(name Privy)
			(players Rebels General-Side)
			(positions f2 f3 f4 g3)
        )
	)

    (piece
      (name General)
	  (help "将：沿线移动，挖吃")
	  (description "将\沿线移动。\若将走完之后在任一方向形成“兵将兵”的棋形，则这两个兵被吃。")
      (image General-Side "images\Solitaire\RedMarble2.bmp" "images\Solitaire\RedMarble.bmp")
      (moves
         (intervention-shift n   e w  ne sw  se nw)
         (intervention-shift s   e w  ne sw  se nw)
         (intervention-shift e   n s  ne sw  se nw)
         (intervention-shift w   n s  ne sw  se nw)
         (intervention-shift nw  e w  n s    ne sw)
         (intervention-shift se  e w  n s    ne sw)
         (intervention-shift sw  e w  n s    se nw)
         (intervention-shift ne  e w  n s    se nw)
       )
	)

    (piece
      (name Rebel)
      (image Rebels "images\Solitaire\YellowMarble2.bmp" "images\Solitaire\YellowMarble.bmp")
	  (help "兵：沿线移动，不可进入右方大营，夹吃")
      (description "兵\沿线移动。\若兵走完后形成“兵将兵”的棋形，则将被吃。")
      (moves
         (rebel-shift n)
         (rebel-shift s)
         (rebel-shift e)
         (rebel-shift w)
         (rebel-shift nw)
         (rebel-shift ne)
         (rebel-shift sw)
         (rebel-shift se)
         ;(custodian-shift n   n ne e  se    sw w  nw)
         ;(custodian-shift ne  n ne e  se s     w  nw)
         ;(custodian-shift e   n ne e  se s  sw    nw)
         ;(custodian-shift se  n ne e  se s  sw w    )
         ;(custodian-shift s     ne e  se s  sw w  nw)
         ;(custodian-shift sw  n    e  se s  sw w  nw)
         ;(custodian-shift w   n ne    se s  sw w  nw)
         ;(custodian-shift nw  n ne e     s  sw w  nw)
      )			
	)
    (piece (name Goose))
    (piece (name Fox))
        
    (board-setup
        (Rebels (Rebel
                a5 b5 c5 d5 e5
                a4          e4
                a3          e3
				a2          e2
				a1 b1 c1 d1 e1
        ))
        (General-Side (General c3))
	)

    (loss-condition (Rebels) (pieces-remaining 6 Rebel))
    (loss-condition (General-Side) (pieces-remaining 0 General))
    (loss-condition (General-Side) stalemated)
	(win-condition (Rebels)
	   (and (absolute-config Rebel (e2 e3 e4))
	        (absolute-config (opponent General) (Privy)))
    )
)

(variant
    (title "16兵对将军二")
    (description "基本的胜利条件和大营规则同上。\
本规则将可跳杀，兵不可吃将，但可以通过堵死将使其无路可走获胜。或把将堵在大营里也可获胜。")
    (history "The game of 16 rebel soldiers is an old Chinese game known as `Shap luk kon
	   tseung kwan` or `16 pursue the general.`  The German scholar Himly wrote in the 1870's
	   that the game was very popular with `laborers and children,` the board being often scratched
	   out in the dust of quiet roads.  Several variations on this game from different sources
	   are provided.")
    (strategy "The Rebels should approach the General in an effort to surround him.")
    (players General-Side Rebels)
    (turn-order General-Side Rebels)

    (board
        (image "images\Rebels\16_Rebels_II.bmp")
        (grid
            (start-rectangle 12 5 36 29); top-left position
            (dimensions ;5 x 5
                ("a/b/c/d/e" (32 0)) ; columns
                ("5/4/3/2/1" (0 32)) ; rows
			)
			(directions (n 0 -1) (s 0 1) (e 1 0) (w -1 0))
		)
		(positions (RR5 182  31 202  51)
		           (RR3 191  69 211  93)
				   (RR1 182 111 202 131)
				   (R4  165  50 185  70)
				   (R3  168  71 188  91)
				   (R2  165  92 185 112)
		)
		(links n (RR1 RR3) (RR3 RR5)
				 (R2 R3) (R3 R4)
		)
		(links s (RR5 RR3) (RR3 RR1)
				 (R4 R3) (R3 R2)
		)
		(links e (e3 R3) (R3 RR3))
		(links w (RR3 R3) (R3 e3))
        (links ne (a1 b2) (a3 b4) (b2 c3) (b4 c5)
                  (c1 d2) (c3 d4) (d2 e3) (d4 e5)
				  (e3 R4) (R4 RR5)
        )
        (links nw (b2 a3) (b4 a5) (c1 b2) (c3 b4)
                  (d2 c3) (d4 c5) (e1 d2) (e3 d4)
				  (RR1 R2) (R2 e3)
        )
        (links sw (b2 a1) (b4 a3) (c3 b2) (c5 b4)
                  (d2 c1) (d4 c3) (e3 d2) (e5 d4)
				  (RR5 R4) (R4 e3)
        )
        (links se (a3 b2) (a5 b4) (b2 c1) (b4 c3)
                  (c3 d2) (c5 d4) (d2 e1) (d4 e3)
				  (e3 R2) (R2 RR1)
        )
        (zone
			(name Privy)
			(players Rebels General-Side)
			(positions R2 R3 R4 RR1 RR3 RR5)
        )
	)

    (piece
      (name General)
	  (help "将：沿线移动，可跳杀")
      (description "将\沿线移动，可以跳过一个兵并杀死之，不可连跳")
      (image General-Side "images\Alquerque\BrownCircle.bmp")
      (moves
         (shift-jump n)
         (shift-jump s)
         (shift-jump e)
         (shift-jump w)
         (shift-jump nw)
         (shift-jump ne)
         (shift-jump sw)
         (shift-jump se)
       )
	)

    (piece
      (name Rebel)
	  (help "兵：不可进入大营，不可吃子")
      (description "兵\沿线移动，不可进入大营，不可吃子")
	  (image Rebels "images\Alquerque\GrayCircle.bmp")
      (moves
         (rebel-shift n)
         (rebel-shift s)
         (rebel-shift e)
         (rebel-shift w)
         (rebel-shift nw)
         (rebel-shift ne)
         (rebel-shift sw)
         (rebel-shift se)
      )			
	)
    (piece (name Goose))
    (piece (name Fox))
        
    (board-setup
        (Rebels (Rebel
                a5 b5 c5 d5 e5
                a4          e4
                a3          e3
				a2          e2
				a1 b1 c1 d1 e1
        ))
        (General-Side (General c3))
	)

    (loss-condition (Rebels) (pieces-remaining 6 Rebel))
    (loss-condition (General-Side) stalemated)
	(win-condition (Rebels)
	   (and (absolute-config Rebel (d2 d3 d4 e3))
	        (absolute-config (opponent General) (Privy)))
    )
)

(variant
    (title "20兵围将")
    (description "将的目标是杀死敌兵使敌兵少于7人，或走到逃脱点（黄圈位置）；兵的目标是困死将使其无法移动。\
将可以横向或纵向跳杀兵。兵不可吃子。")
    (history "The game of 16 rebel soldiers is an old Chinese game known as `Shap luk kon
	   tseung kwan` or `16 pursue the general.`  The German scholar Himly wrote in the 1870's
	   that the game was very popular with `laborers and children,` the board being often scratched
	   out in the dust of quiet roads.  Several variations on this game from different sources
	   are provided.")
    (strategy "The Rebels should win as they can easily protect themselves from capture.
	   Compare this with the other version of `Chinese Rebels` which gives the General
	   a different form of capture.  As the Rebel side, you should try to see how many
	   moves it takes you to stalemate the General.")
    (players General-Side Rebels)
    (turn-order General-Side Rebels)

    (board
        (image "images\Rebels\20_Rebels2.bmp" "images\Rebels\20_Rebels.bmp")
        (grid
            (start-rectangle 3 3 29 29) ; top-left position
            (dimensions
                ("a/b/c/d/e/f/g/h/i" (32 0)) ; columns
                ("5/4/3/2/1" (0 32)) ; rows
			)
			(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0))
		)
        (kill-positions h1 h5 i1 i2 i4 i5)
	)

    (piece
      (name General)
	  (help "将：直向移动一格，可跳杀")
      (description "将\横或纵移动一格，可以跳过一个兵并杀死之，不可连跳")
      (image General-Side "images\Solitaire\RedMarble2.bmp" "images\Solitaire\RedMarble.bmp")
      (moves
         (shift-jump n)
         (shift-jump s)
         (shift-jump e)
         (shift-jump w)
       )
	)

    (piece
      (name Rebel)
	  (help "兵：横纵一格，不可吃子")
      (description "兵\横向或纵向走一格，不可进入大营，不可吃子")
      (image Rebels "images\Solitaire\YellowMarble2.bmp" "images\Solitaire\YellowMarble.bmp")
      (moves
         (shift n)
         (shift s)
         (shift e)
         (shift w)
      )			
	)
    (piece (name Goose))
    (piece (name Fox))
        
    (board-setup
        (Rebels (Rebel
                a4 b4 c4 d4 e4 f4 g4
                a3 b3 c3    e3 f3 g3
                a2 b2 c2 d2 e2 f2 g2
        ))
        (General-Side (General d3))
	)

    (loss-condition (Rebels) (pieces-remaining 6 Rebel))
    (loss-condition (General-Side) stalemated)
	(win-condition (General-Side) (absolute-config General (h3)))
)

(variant
    (title "26兵围将")
    (description "将的目标是杀死敌兵使敌兵少于7人；兵的目标是困死将使其无法移动，或将其困在大营中无法出来。\
将可以横向或纵向跳杀兵，可连杀。兵不可吃子，不可进入大营。。")
    (history "The game of 16 rebel soldiers is an old Chinese game known as `Shap luk kon
	   tseung kwan` or `16 pursue the general.`  The German scholar Himly wrote in the 1870's
	   that the game was very popular with `laborers and children,` the board being often scratched
	   out in the dust of quiet roads.  Several variations on this game from different sources
	   are provided.")
    (strategy "The Rebels should approach the General in an effort to surround him.")
    (players General-Side Rebels)
    (turn-order General-Side Rebels)

    (board
        (image "images\Rebels\26_Rebels2.bmp"  "images\Rebels\26_Rebels.bmp")
        (grid
            (start-rectangle 3 3 29 29) ; top-left position
            (dimensions
                ("a/b/c/d/e/f/g/h/i" (32 0)) ; columns
                ("5/4/3/2/1" (0 32)) ; rows
			)
			(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0))
		)
		(positions (j4  285  44 309  69)
		           (j3  285  68 309  92)
				   (j2  285  91 309 115)
				   (k3  313  68 337  92)
		)
		(links n  (j2 j3) (j3 j4) (j4 k3) (k3 j2))
		(links s  (j3 j2) (j4 j3) (k3 j4) (j2 k3))
		(links e  (i2 j2) (i3 j3) (i4 j4) (j3 k3))
		(links w  (j2 i2) (j3 i3) (j4 i4) (k3 j3))
        (zone
			(name Privy)
			(players Rebels General-Side)
			(positions j2 j3 j4 k3)
        )
	)

    (piece
      (name General)
	  (help "将：沿线移动，可连续跳杀")
      (description "将\沿线移动，可以跳过一个兵并杀死之，可连跳。")
      (image General-Side "images\Solitaire\RedMarble2.bmp"  "images\Solitaire\RedMarble.bmp")
      (moves
         (move-type jumptype)
         (jump n)
         (jump s)
         (jump e)
         (jump w)

         (move-type nonjumptype)
         (shift n)
         (shift s)
         (shift e)
         (shift w)
       )
	)

    (piece
      (name Rebel)
	  (help "兵：不可进入大营，不可吃子")
      (description "兵\沿线移动，不可进入大营，不可吃子")
      (image Rebels "images\Solitaire\YellowMarble2.bmp" "images\Solitaire\YellowMarble.bmp")
      (moves
         (rebel-shift n)
         (rebel-shift s)
         (rebel-shift e)
         (rebel-shift w)
      )			
	)
    (piece (name Goose))
    (piece (name Fox))
        
    (board-setup
        (Rebels (Rebel
                a4 b4 c4 d4 e4 f4 g4 h4 i4
				a3 b3 c3 d3    f3 g3 h3 i3
                a2 b2 c2 d2 e2 f2 g2 h2 i2
        ))
        (General-Side (General e3))
	)

    (loss-condition (Rebels) (or (pieces-remaining 6 Rebel)
                                 (pieces-remaining 5 Rebel)
                                 (pieces-remaining 4 Rebel)
                                 (pieces-remaining 3 Rebel)
                                 (pieces-remaining 2 Rebel)
                                 (pieces-remaining 1 Rebel)))
    (loss-condition (General-Side Rebels) stalemated)
	(win-condition (Rebels)
	   (and (absolute-config Rebel (h2 h3 h4 i2 i3 i4))
	        (absolute-config (opponent General) (Privy)))
    )
)
